<template>
	<a-divider>{{ $t('login.signInOther') }}</a-divider>
	<a-button
		type="primary"
		class="w-full"
		:loading="ssoloading"
		round
		size="large"
		@click="scnuLogin"
		style="background-color: #dc444f; border: 0"
		>华南师范大学统一认证登录
	</a-button>
	<!--	<div class="login-oauth layout-center" style="margin-top: 10px">-->
	<!--		<a-space align="start">-->
	<!--			<a @click="getLoginRenderUrl('gitee')"><GiteeIcon /></a>-->
	<!--			<a-button type="primary" shape="circle">-->
	<!--				<wechat-filled />-->
	<!--			</a-button>-->
	<!--		</a-space>-->
	<!--	</div>-->
</template>

<script setup name="threeLogin">
	import thirdApi from '@/api/auth/thirdApi'
	import loginApi from '@/api/auth/loginApi'

	const ssoloading = ref(false)

	const getLoginRenderUrl = (platform) => {
		const param = {
			platform: platform
		}
		thirdApi.thirdRender(param).then((data) => {
			window.location.href = data.authorizeUrl
		})
	}

	const scnuLogin = async () => {
		ssoloading.value = true

		try {
			await loginApi.getSSOLoginURL().then((url) => {
				// console.log('ssoinit url: ', url)
				location.replace(url)
			})
		} catch (err) {
			console.log(err)
			ssoloading.value = false
		}
	}
</script>
